from django.db import models
from django.contrib.auth.models import User
from game_core.models import Skill, Monster

class Collection(models.Model):
    user = models.ForeignKey(User, on_delete=models.CASCADE)
    discovered_skills = models.ManyToManyField(Skill)
    discovered_monsters = models.ManyToManyField(Monster)
    achievement_points = models.IntegerField(default=0)

class Achievement(models.Model):
    name = models.CharField(max_length=100)
    description = models.TextField()
    points = models.IntegerField()
    users = models.ManyToManyField(User, through='UserAchievement')

class UserAchievement(models.Model):
    user = models.ForeignKey(User, on_delete=models.CASCADE)
    achievement = models.ForeignKey(Achievement, on_delete=models.CASCADE)
    achieved_at = models.DateTimeField(auto_now_add=True) 